#ifndef _ODN_SCENE_SCENE_H
#define _ODN_SCENE_SCENE_H

//Engine headers
#include "odn_scene_SceneElement.h"
#include "odn_scene_SceneObject.h"
#include "odn_scene_CollisionManager.h"
#include "odn_scene_Camera.h"
#include "odn_file_Reader.h"

//Standard library headers
#include <vector>

#define DEFAULT_SCENE_WIDTH 100
#define DEFAULT_SCENE_HEIGHT 100

//TODO: See if can make this a variable instead
#define DEFAULT_SECTOR_WIDTH 100
#define DEFAULT_SECTOR_HEIGHT 100

namespace ouden
{
	namespace scene
	{
		
		class ODN_Scene : public ouden::file::ODN_LoadableObject
		{
			
		public:
			
			//Constructor 
			ODN_Scene(Vector3D Size = Vector3D(DEFAULT_SCENE_WIDTH, DEFAULT_SCENE_HEIGHT)) : size(Size)
			{
				//Initialise the sector system 
				setSectorSize(size); 
			}
			
			//Destructor 
			~ODN_Scene();
			
			//Updates all scene elements 
			bool Update();
			
			//Draws all scene elements 
			bool Draw();

			//Adds a new element to the scene 
			ODN_SceneElement* addElement(ODN_SceneElement* e);
			
			//Adds a new dynamic point to the scene 
			ODN_DynamicPoint* addDynamicPoint(ODN_DynamicPoint* p);
		
			//Remove an element from the scene 
			void killElement(ODN_SceneElement* e);
			
			//Variable access functions
			bool isVisible()				{ return visible; }
			bool isActive()					{ return active; }
			void Show()						{ visible = true; }
			void Hide()						{ visible = false; }
			void Run()						{ active = true; }
			void Pause()					{ active = false; }
			
			void setSize(Vector3D Size)					{ size=Size; }
			void setSectorSize(Vector3D SectorSize); 
			
			//Overloaded data loading functions for persistence 
			virtual void readDataHeader()		{}
			virtual void processDataSection(sSectionHeader SectionHeader)		{}
		
		private:
			
			//Dimensions of the scene 
			Vector3D size;
			
			//Instance of the scene camera 
			ODN_Camera camera; 
			
			//Instance of the collision manager
			ODN_CollisionManager collisionmanager;
			
			//Array of all scene elements
			std::vector<ODN_SceneElement*> sceneelements;
			
		};
		
	} //namespace scene 
} //namespace ouden 

#endif //_ODN_SCENE_SCENE_H
